;#############################
;命令：
;nasm -f elf64 day2_0function_2function_with_multiple_parameters_2pro.asm -o main.o && gcc main.o -o main -lc -no-pie && ./main
;输出：
;传入参数为：0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
;#############################
extern printf

section .data
	msg: db `传入参数为：%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n`, 0

section .text
	global main

main:
	push rbp
	mov rbp, rsp

	push 11
	push 10
	push 9
	push 8
	push 7
	push 6
	mov r9, 5
	mov r8, 4
	mov rcx, 3
	mov rdx, 2
	mov rsi, 1
	mov rdi, 0
	call this_is_my_printf

	add rsp, 48

	mov eax, 0
	leave
	ret

this_is_my_printf:
	push rbp
	mov rbp, rsp

;############################################
	;打印
	;不放入内存
	;直接将其打印出去
	sub rsp, 8
	push qword [rbp + 16 + 8 * 5]
	push qword [rbp + 16 + 8 * 4]
	push qword [rbp + 16 + 8 * 3]
	push qword [rbp + 16 + 8 * 2]
	push qword [rbp + 16 + 8 * 1]
	push qword [rbp + 16 + 8 * 0]
	push r9
	mov r9, r8
	mov r8, rcx
	mov rcx, rdx
	mov rdx, rsi
	mov rsi, rdi
	mov rdi, msg
	call printf

	add rsp, 64
;############################################

	leave
	ret
